﻿Public Class FormMain
    Dim objUser As New clsUser
    Private Sub FormMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Maximized
        connectDB()
        getUserListByCJ()
    End Sub

    Private Sub connectDB()
        g_szInitFileName = My.Application.Info.DirectoryPath & "\Client_Gt.ini"
        g_jsInitFileName = My.Application.Info.DirectoryPath & "\js.ini"
        g_Server.szDrive = GetIniFile("SERVER", "DRIVE", "PostgreSQL ANSI", g_szInitFileName)
        g_Server.szIPadr = GetIniFile("SERVER", "IP", "", g_szInitFileName)
        g_Server.szDbn = GetIniFile("SERVER", "DBN", "ZHENANSF", g_szInitFileName)
        g_Server.szUid = GetIniFile("SERVER", "UID", "sa", g_szInitFileName)
        g_Server.szPas = GetIniFile("SERVER", "PAS", "sa", g_szInitFileName)
        g_Server.iOver = CInt(GetIniFile("SERVER", "OVER", "-1", g_szInitFileName))

        If False = g_fDBconnect And 0 = g_iDBconnResult Then
            If "" = g_Server.szIPadr Or "0.0.0.0" = g_Server.szIPadr Then
            Else
                g_fDBconnect = True

                'データベース接続
                With g_Server
                    g_iDBconnResult = DBacs.Connect(.szDrive, .szIPadr, .szDbn, .szUid, .szPas, .iOver)
                    If 1 <> g_iDBconnResult Then
                        .szDrive = CStr(IIf("PostgreSQL" = .szDrive, "PostgreSQL ANSI", "PostgreSQL"))
                        g_iDBconnResult = DBacs.Connect(.szDrive, .szIPadr, .szDbn, .szUid, .szPas, .iOver)
                    End If
                End With
            End If
        End If

    End Sub

    Private Sub getUserListByCJ()
        Dim dtUser As DataTable = objUser.getUserListByCJ(1)
        cmbOper.DisplayMember = "user_name"
        cmbOper.ValueMember = "user_id"
        cmbOper.DataSource = dtUser
    End Sub


    Private Sub btnMesPlan_Click(sender As Object, e As EventArgs) Handles btnMesPlan.Click
        Dim formMesPlan As New FormMesPlan()
        formMesPlan.usr = cmbOper.Text.Trim()
        formMesPlan.btnShow = False
        formMesPlan.originForm = String.Empty
        formMesPlan.ShowDialog(Me)
    End Sub

    Private Sub btnCheck_Click(sender As Object, e As EventArgs) Handles btnCheck.Click
        Dim formCheck As New FormCheck()
        formCheck.usr = cmbOper.Text.Trim()
        formCheck.ShowDialog(Me)
    End Sub

    Private Sub btnNgList_Click(sender As Object, e As EventArgs) Handles btnNgList.Click
        Dim formNgList As New FormNgList()
        formNgList.usr = cmbOper.Text.Trim()
        formNgList.ShowDialog(Me)
    End Sub

    Private Sub btnLingLiaoFlb_Click(sender As Object, e As EventArgs) Handles btnLingLiaoFlb.Click
        Dim formPicking As New FormPicking()
        formPicking.usr = cmbOper.Text.Trim()
        formPicking.ty = "1"
        formPicking.ShowDialog(Me)
    End Sub

    Private Sub btnLingLiaoGjb_Click(sender As Object, e As EventArgs) Handles btnLingLiaoGjb.Click
        Dim formPicking As New FormPicking()
        formPicking.usr = cmbOper.Text.Trim()
        formPicking.ty = "0"
        formPicking.ShowDialog(Me)
    End Sub

    Private Sub btnJiaoPing_Click(sender As Object, e As EventArgs) Handles btnJiaoPing.Click
        Dim formOperJP As New FormOperJP()
        formOperJP.usr = cmbOper.Text.Trim()
        formOperJP.ShowDialog(Me)
    End Sub

    Private Sub btnPenShaQingXiFlb_Click(sender As Object, e As EventArgs) Handles btnPenShaQingXiFlb.Click
        Dim formOperPSQX1 As New FormOperPSQX1()
        formOperPSQX1.usr = cmbOper.Text.Trim()
        formOperPSQX1.ShowDialog(Me)
    End Sub
    Private Sub btnPenShaQingXiGjb0_Click(sender As Object, e As EventArgs) Handles btnPenShaQingXiGjb0.Click
        Dim formOperPSQX00 As New FormOperPSQX00()
        formOperPSQX00.usr = cmbOper.Text.Trim()
        formOperPSQX00.ShowDialog(Me)
    End Sub
    Private Sub btnPenShaQingXiGjb_Click(sender As Object, e As EventArgs) Handles btnPenShaQingXiGjb.Click
        Dim formOperPSQX0 As New FormOperPSQX0()
        formOperPSQX0.usr = cmbOper.Text.Trim()
        formOperPSQX0.ShowDialog(Me)
    End Sub

    Private Sub btn3GongWei_Click(sender As Object, e As EventArgs) Handles btn3GongWei.Click
        Dim form3GongWei As New Form3GongWei()
        form3GongWei.usr = cmbOper.Text.Trim()
        form3GongWei.ShowDialog(Me)
    End Sub

    Private Sub btn3GongWeiOut_Click(sender As Object, e As EventArgs) Handles btn3GongWeiOut.Click
        Dim form3GongWeiOut As New Form3GongWeiOut()
        form3GongWeiOut.usr = cmbOper.Text.Trim()
        form3GongWeiOut.ShowDialog(Me)
    End Sub

    Private Sub btn6GongWei0_Click(sender As Object, e As EventArgs) Handles btn6GongWei0.Click
        Dim form6GongWei As New Form6GongWei()
        form6GongWei.usr = cmbOper.Text.Trim()
        form6GongWei.status = "1"
        form6GongWei.ShowDialog(Me)
    End Sub

    Private Sub btn6GongWei_Click(sender As Object, e As EventArgs) Handles btn6GongWei.Click
        Dim form6GongWei As New Form6GongWei()
        form6GongWei.usr = cmbOper.Text.Trim()
        form6GongWei.status = "2"
        form6GongWei.ShowDialog(Me)
    End Sub

    Private Sub btn6GongWeiOut_Click(sender As Object, e As EventArgs) Handles btn6GongWeiOut.Click
        Dim form6GongWeiOut As New Form6GongWeiOut()
        form6GongWeiOut.usr = cmbOper.Text.Trim()
        form6GongWeiOut.ShowDialog(Me)
    End Sub

    Private Sub FormMain_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed
        DBacs.Disconnect()
    End Sub

    Private Sub acePTGBMHJC_Click(sender As Object, e As EventArgs) Handles acePTGBMHJC.Click
        Dim formPTGBMHJC As New FormPTGBMHJC()
        formPTGBMHJC.usr = cmbOper.Text.Trim()
        formPTGBMHJC.ShowDialog(Me)
    End Sub

    Private Sub acePTGBMHJCJL_Click(sender As Object, e As EventArgs) Handles acePTGBMHJCJL.Click
        Dim formPTGBMHJCRecord As New FormPTGBMHJCRecord()
        formPTGBMHJCRecord.ShowDialog(Me)
    End Sub

    Private Sub acePTJNJNDJC_Click(sender As Object, e As EventArgs) Handles acePTJNJNDJC.Click
        Dim formPTJNJNDJC As New FormPTJNJNDJC()
        formPTJNJNDJC.usr = cmbOper.Text.Trim()
        formPTJNJNDJC.ShowDialog(Me)
    End Sub

    Private Sub acePTJNJNDJCJL_Click(sender As Object, e As EventArgs) Handles acePTJNJNDJCJL.Click
        Dim formPTJNJNDJCRecord As New FormPTJNJNDJCRecord()
        formPTJNJNDJCRecord.ShowDialog(Me)
    End Sub

    Private Sub aceGTJNJNDJC_Click(sender As Object, e As EventArgs) Handles aceGTJNJNDJC.Click
        Dim formGTJNJNDJC As New FormGTJNJNDJC()
        formGTJNJNDJC.usr = cmbOper.Text.Trim()
        formGTJNJNDJC.ShowDialog(Me)
    End Sub

    Private Sub aceGTJNJNDJCJL_Click(sender As Object, e As EventArgs) Handles aceGTJNJNDJCJL.Click
        Dim formGTJNJNDJCRecord As New FormGTJNJNDJCRecord()
        formGTJNJNDJCRecord.ShowDialog(Me)
    End Sub

    Private Sub acePTGBBJWDJC_Click(sender As Object, e As EventArgs) Handles acePTGBBJWDJC.Click
        Dim formPTGBBMWDJC As New FormPTGBBMWDJC()
        formPTGBBMWDJC.usr = cmbOper.Text.Trim()
        formPTGBBMWDJC.ShowDialog(Me)
    End Sub

    Private Sub aceacePTGBBJWDJCJL_Click(sender As Object, e As EventArgs) Handles aceacePTGBBJWDJCJL.Click
        Dim formPTGBBMWDJCRecord As New FormPTGBBMWDJCRecord()
        formPTGBBMWDJCRecord.ShowDialog(Me)
    End Sub

    Private Sub aceJNJPB_Click(sender As Object, e As EventArgs) Handles aceJNJPB.Click
        Dim formJNJPB As New FormJNJPB()
        formJNJPB.usr = cmbOper.Text.Trim()
        formJNJPB.ShowDialog(Me)
    End Sub

    Private Sub aceJNJPBRecord_Click(sender As Object, e As EventArgs) Handles aceJNJPBRecord.Click
        Dim formJNJPBRecord As New FormJNJPBRecord()
        formJNJPBRecord.ShowDialog(Me)
    End Sub

    Private Sub aceGBQJZJ_Click(sender As Object, e As EventArgs) Handles aceGBQJZJ.Click
        Dim formGBQJZJ As New FormGBQJZJ()
        formGBQJZJ.usr = cmbOper.Text.Trim()
        formGBQJZJ.ShowDialog(Me)
    End Sub

    Private Sub aceGBQJZJRecord_Click(sender As Object, e As EventArgs) Handles aceGBQJZJRecord.Click
        Dim formGBQJZJRecord As New FormGBQJZJRecord()
        formGBQJZJRecord.ShowDialog(Me)
    End Sub

    Private Sub aceGTGBMHJC_Click(sender As Object, e As EventArgs) Handles aceGTGBMHJC.Click
        Dim formGTGBMHJC As New FormGTGBMHJC()
        formGTGBMHJC.usr = cmbOper.Text.Trim()
        formGTGBMHJC.ShowDialog(Me)
    End Sub

    Private Sub aceGTGBMHJCJL_Click(sender As Object, e As EventArgs) Handles aceGTGBMHJCJL.Click
        Dim formGTGBMHJCRecord As New FormGTGBMHJCRecord()
        formGTGBMHJCRecord.ShowDialog(Me)
    End Sub

    Private Sub AceaceGTGBBJWDJC_Click(sender As Object, e As EventArgs) Handles aceaceGTGBBJWDJC.Click
        Dim formGTGBBMWDJC As New FormGTGBBMWDJC()
        formGTGBBMWDJC.usr = cmbOper.Text.Trim()
        formGTGBBMWDJC.ShowDialog(Me)
    End Sub

    Private Sub aceaceGTGBBJWDJCJL_Click(sender As Object, e As EventArgs) Handles aceaceGTGBBJWDJCJL.Click
        Dim formGTGBBJWDJCRecord As New FormGTGBBMWDJCRecord()
        formGTGBBJWDJCRecord.ShowDialog(Me)
    End Sub


End Class